#include <iostream>
#include <signal.h>
using namespace std;

void handle(int signo)
{
    cout<<"信号为"<<signo<<",出现了硬件异常"<<endl;
}
int main()
{
    signal(SIGSEGV,handle);
    //signal(SIGFPE,handle);
    cout<<"begin"<<endl;
    //int a=1;
    //a/=0;
    int* p=nullptr;
    *p=100;
cout<<"end"<<endl;






    return 0;
}